/*package com.wj.console.common.listener;

import java.util.concurrent.Executors;
import org.lhfe.rabbitmq.producer.MqSender;
import org.springframework.context.ApplicationContext;
import com.rabbitmq.client.ConnectionFactory;
import com.wj.console.constant.Constant;


*//**
 * rabbitMq预加载
 * @author wj
 * 
 *//*
public class RabitMqListener extends AbstractResourcePreloaderListener {
	
	@Override
	protected void preload(ApplicationContext applicationContext) {
		//初始化rabbitMq connection工厂注入
		initRabbitMqConnect(applicationContext);
	}
	
	public void initRabbitMqConnect(ApplicationContext applicationContext) {
		Constant constant = applicationContext.getBean(Constant.class);
		String host = constant.getRabbitmqHost();
		int port = Integer.parseInt(constant.getRabbitmqPort()); //端口
		String userName = constant.getRabbitmqUsername(); //用户名
		String passWord = constant.getRabbitmqPassword(); //密码
		initProduct(host,port,userName,passWord); 
	}
	
	*//**
	 * 生产端初始化
	 * @param host
	 * @param port
	 * @param userName
	 * @param passWord
	 *//*
	private void initProduct(String host, int port, String userName,
			String passWord) {
		ConnectionFactory fac = new ConnectionFactory();	
        //设置RabbitMQ所在主机ip或者主机名  	
        fac.setHost(host);
        
        //设置RabbitMQ端口
        fac.setPort(port);
        
        //设置RabbitMQ用户名
        fac.setUsername(userName);		
        
        //设置RabbitMQ密码
        fac.setPassword(passWord);
        
        //此值已经在rabbitmq底层程序中设置了，只不过每次调用客户端都要调用一下 Runtime.getRuntime()...所以我就把它拿出来了，显示的设置上，节省一下效率，不做程序做重复的无用功，尤其是像这种频繁操作的处理。											
        fac.setSharedExecutor(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2, Executors.defaultThreadFactory()));											
        
        //客户端和服务端的握手时间，此时间设置的过小，则容易出现concurrentTimeOut，这里默认设置500000							
        fac.setConnectionTimeout(15000);	
        fac.setHandshakeTimeout(500000);	
        MqSender.cf = fac;
		
	}
}
*/